<?php

class Cache_Frontend_Config extends Zend_Cache_Frontend_File implements ISingleton
{
    /**
     * @var Cache_Frontend_Config
     */
    protected static $instance = null;
    
    /**
     * @return Cache_Frontend_Config
     */
    public static function getInstance()
    {
        if (self::$instance === null) {
            self::$instance = new self();
        }
        
        return self::$instance;
    }
    
    /**
     * Setup master files. 
     */
	public function __construct()
	{
		$dir = BASE_DIR . '/config';
		$files = array(
			$dir . '/config.ini',
			$dir . '/sitemap.xml',
			$dir . '/routes.ini',
		);
		
		$backend = Cache_Manager::getInstance()->getBackend();
		$this->setBackend($backend);
		
		$options = array(
			'master_files' => $files,
			'master_files_mode' => Zend_Cache_Frontend_File::MODE_OR,
			'automatic_serialization' => true,
		);
		
		parent::__construct($options);
	}
}